<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 6.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"aoce888.gitee.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"always","padding":18,"offset":12,"onmobile":true},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="Git配置仓库公钥安装Git打开《Git工具下载地址》,下载并完成安装">
<meta property="og:type" content="article">
<meta property="og:title" content="Git配置仓库公钥及使用">
<meta property="og:url" content="https://aoce888.gitee.io/posts/d95dc0b0.html">
<meta property="og:site_name" content="Crf&#39;s Blog">
<meta property="og:description" content="Git配置仓库公钥安装Git打开《Git工具下载地址》,下载并完成安装">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://aoce888.gitee.io/posts/d95dc0b0/a00.png">
<meta property="article:published_time" content="2023-06-01T07:14:21.000Z">
<meta property="article:modified_time" content="2023-11-10T05:00:06.859Z">
<meta property="article:author" content="Crf&#39;s Blog">
<meta property="article:tag" content="Git">
<meta property="article:tag" content="公钥">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://aoce888.gitee.io/posts/d95dc0b0/a00.png">

<link rel="canonical" href="https://aoce888.gitee.io/posts/d95dc0b0.html">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Git配置仓库公钥及使用 | Crf's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">

  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Crf's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">11</span></a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">20</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">6</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://aoce888.gitee.io/posts/d95dc0b0.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/touxiang.gif">
      <meta itemprop="name" content="Crf's Blog">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Crf's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Git配置仓库公钥及使用
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2023-06-01 15:14:21" itemprop="dateCreated datePublished" datetime="2023-06-01T15:14:21+08:00">2023-06-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-11-10 13:00:06" itemprop="dateModified" datetime="2023-11-10T13:00:06+08:00">2023-11-10</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%85%B6%E4%BB%96%E6%8A%80%E6%9C%AF/" itemprop="url" rel="index"><span itemprop="name">其他技术</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>4 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="Git配置仓库公钥"><a href="#Git配置仓库公钥" class="headerlink" title="Git配置仓库公钥"></a>Git配置仓库公钥</h2><h3 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h3><p>打开<a target="_blank" rel="noopener" href="https://git-scm.com/downloads">《Git工具下载地址》</a>,下载并完成安装</p>
<span id="more"></span>
<h3 id="获取远程仓库地址SSH"><a href="#获取远程仓库地址SSH" class="headerlink" title="获取远程仓库地址SSH"></a>获取远程仓库地址SSH</h3><p>这里如果是Gitee可以看<a href="bd5b3fbb">《Hexo搭建笔记》</a>里的<strong>Gitee部署</strong>的<strong>创建仓库</strong> 章节,最终获取SSH地址 <a href="mailto:&#103;&#105;&#116;&#64;&#x67;&#105;&#116;&#x65;&#101;&#x2e;&#99;&#111;&#x6d;">&#103;&#105;&#116;&#64;&#x67;&#105;&#116;&#x65;&#101;&#x2e;&#99;&#111;&#x6d;</a>:name&#x2F;仓库名.git，如在<strong>创建仓库</strong> 章节里最终获取地址</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git@gitee.com:Aoce888/Aoce888.git</span><br></pre></td></tr></table></figure>

<p>其他也都大同小异如阿里云：在阿里云创建项目，获取SSH地址 ***.git（示例地址，每个项目SSH地址不同）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">最终获取地址：**git@code.aliyun.com:playale/*.git**</span><br></pre></td></tr></table></figure>
<h3 id="配置仓库公钥"><a href="#配置仓库公钥" class="headerlink" title="配置仓库公钥"></a>配置仓库公钥</h3><p>在安装好git后，在本地创建一个与云仓库共同名称（示例文件夹名 nameA），右键进行库配置操作</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">右键nameA--&gt;git bash here 进行全局配置用户信息操作</span><br><span class="line">git config --global user.name &quot;username&quot;  配置用户名</span><br><span class="line">git config --global user.email useremail@qq.com 配置邮箱</span><br></pre></td></tr></table></figure>

<p>用户信息配好后获取公钥：</p>
<ul>
<li>(方法一) 输入ssh-keygen -t rsa -C “<a href="mailto:&#x75;&#115;&#101;&#114;&#x65;&#109;&#x61;&#x69;&#x6c;&#x40;&#113;&#x71;&#x2e;&#99;&#111;&#x6d;">&#x75;&#115;&#101;&#114;&#x65;&#109;&#x61;&#x69;&#x6c;&#x40;&#113;&#x71;&#x2e;&#99;&#111;&#x6d;</a>“  （这里的邮箱是你配置用户的邮箱，回车全部按enter）；</li>
</ul>
<p>操作完成后SSH密钥默默认储存在帐户的主目录下的 ~&#x2F;.ssh</p>
<ul>
<li>(方法二) 这里提供个更简捷的方法，在上面新建的nameA文件夹 右键–&gt;git  GUI here</li>
</ul>
<p>在窗口上找到help–&gt;show SSHkey –&gt;Copy</p>
<p><img src="/posts/d95dc0b0/a00.png" alt="image-a00"></p>
<p>这样我们就获取了密钥了，下一步就是在创建仓库用户设置上配置我们的Copy公钥<br>打开<a target="_blank" rel="noopener" href="https://gitee.com/">Gitee官网</a> 登录后 首页找到 用户–&gt;设置–&gt;SSH公钥–&gt;增加公钥，把上一个步骤copy的密钥填入</p>
<p>到这一步基本就是完成了，最后一步本地配置链接仓库，nameA右键–&gt;git bash here输入</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git remote add origin SSH地址</span><br><span class="line">git remote add origin git@gitee.com:Aoce888/Aoce888.git  (示例1)</span><br><span class="line">git remote add origin git@code.aliyun.com:playale/nameA.git  (示例2)</span><br></pre></td></tr></table></figure>

<p>这样就可以通过指令从仓库获取内容和提交信息了</p>
<h3 id="Git-bash创建文件指令"><a href="#Git-bash创建文件指令" class="headerlink" title="Git bash创建文件指令"></a>Git bash创建文件指令</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">vim name.file 创建或打开文件 i进入 esc退出后 :wq保存</span><br><span class="line">git add name.file 添加文件 git status查看信息 git commit -m&#x27;添加修改信息&#x27;</span><br><span class="line">git vm old.file new.file 重命名格式</span><br><span class="line">修改备注 git commit --amend 按a进入编辑模式</span><br></pre></td></tr></table></figure>



<h3 id="上传某个文件夹到指定分支"><a href="#上传某个文件夹到指定分支" class="headerlink" title="上传某个文件夹到指定分支"></a>上传某个文件夹到指定分支</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">1、Git init （在本地工程目录下），生成.git 文件夹</span><br><span class="line"></span><br><span class="line">2、上传修改的文件 git add *(*可替换成具体要上传的文件名，*表示提交所有有变化的文件) </span><br><span class="line"></span><br><span class="line">3、添加上传文件的描述</span><br><span class="line">git commit -m &quot;test&quot; （”test“为分支名）</span><br><span class="line"></span><br><span class="line">4、（创建分支）git branch test</span><br><span class="line"></span><br><span class="line">5、（切换分支）git checkout test</span><br><span class="line"></span><br><span class="line">6、与远程分支相关联  git remote add origin @@@@.git</span><br><span class="line"></span><br><span class="line">7、（将分支上传）git push origin test</span><br></pre></td></tr></table></figure>



<h3 id="推送失败解决方案"><a href="#推送失败解决方案" class="headerlink" title="推送失败解决方案"></a>推送失败解决方案</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">1、git pull -- rebase</span><br><span class="line">//针对场景一和二，养成先pull最新代码再修改的习惯即可</span><br><span class="line">//在修改本地代码前，先使用git pull拉取远程最新代码，然后再进行修改（推荐--rebase）</span><br><span class="line">git pull 远程仓库名 远程分支名 --rebase</span><br><span class="line"></span><br><span class="line">2、git push --force</span><br><span class="line">//针对场景三，在确认代码无误的情况下，直接使用--force强制推送</span><br><span class="line">git push 远程仓库名 远程分支名 --force</span><br></pre></td></tr></table></figure>

<h3 id="其他相关问题"><a href="#其他相关问题" class="headerlink" title="其他相关问题"></a>其他相关问题</h3><h4 id="git-commit报错"><a href="#git-commit报错" class="headerlink" title="git commit报错"></a>git commit报错</h4><p>报错内容</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">fatal: Unable to create &#x27;xxx/.git/index:File exists.</span><br><span class="line">Another git process seems to be running in this repository, e.g. an editor opened by ‘git commit’. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier:remove the file manually to continue.</span><br></pre></td></tr></table></figure>

<p>解决方案</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">删除在同级目录下 .git 文件中的 index.lock 文件;</span><br><span class="line">或者直接在命令行输入 rm -f .git/index.lock</span><br></pre></td></tr></table></figure>

<h4 id="git-push-origin-master报错"><a href="#git-push-origin-master报错" class="headerlink" title="git push origin master报错"></a>git push origin master报错</h4><p>报错内容</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">hint: Updates were rejected because the remote contains work that you do</span><br><span class="line">hint: not have locally. This is usually caused by another repository pushing</span><br><span class="line">hint: to the same ref. You may want to first integrate the remote changes</span><br><span class="line">hint: (e.g., &#x27;git pull ...&#x27;) before pushing again.</span><br><span class="line">hint: See the &#x27;Note about fast-forwards&#x27; in &#x27;git push --help&#x27; for details.</span><br></pre></td></tr></table></figure>

<p>解决方案</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">方式一：输入“ `git pull --rebase origin master` ” ，然后输入git push origin master语句</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">方式二：输入“ git pull origin master --allow-unrelated-histories ”（会弹到文件里面，输入“:wq”退出该文件，如果没有遇到，请忽略），然后输入git push origin master语句</span><br><span class="line"></span><br><span class="line">前两种方式不可行的情况下，试试这种方法：“git push -f origin master”</span><br></pre></td></tr></table></figure>

    </div>

    <div>
      
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>
      
    </div>

    
    
    
        <div class="reward-container">
  <div></div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/alipay.png" alt="Crf's Blog 支付宝">
        <p>支付宝</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/paypal.png" alt="Crf's Blog 微信">
        <p>微信</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/bitcoin.png" alt="Crf's Blog BTC">
        <p>BTC</p>
      </div>

  </div>
</div>

        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>Crf's Blog
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://aoce888.gitee.io/posts/d95dc0b0.html" title="Git配置仓库公钥及使用">https://aoce888.gitee.io/posts/d95dc0b0.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_self"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>



      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Git/" rel="tag"># Git</a>
              <a href="/tags/%E5%85%AC%E9%92%A5/" rel="tag"># 公钥</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/posts/ddf07759.html" rel="prev" title="CocosCreator3.x发射瞄准线">
      <i class="fa fa-chevron-left"></i> CocosCreator3.x发射瞄准线
    </a></div>
      <div class="post-nav-item">
    <a href="/posts/4441eb1c.html" rel="next" title="html读取js脚本批量加载图片及超链接">
      html读取js脚本批量加载图片及超链接 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>

      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Git%E9%85%8D%E7%BD%AE%E4%BB%93%E5%BA%93%E5%85%AC%E9%92%A5"><span class="nav-number">1.</span> <span class="nav-text">Git配置仓库公钥</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Git"><span class="nav-number">1.1.</span> <span class="nav-text">安装Git</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%8E%B7%E5%8F%96%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E5%9C%B0%E5%9D%80SSH"><span class="nav-number">1.2.</span> <span class="nav-text">获取远程仓库地址SSH</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE%E4%BB%93%E5%BA%93%E5%85%AC%E9%92%A5"><span class="nav-number">1.3.</span> <span class="nav-text">配置仓库公钥</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Git-bash%E5%88%9B%E5%BB%BA%E6%96%87%E4%BB%B6%E6%8C%87%E4%BB%A4"><span class="nav-number">1.4.</span> <span class="nav-text">Git bash创建文件指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%8A%E4%BC%A0%E6%9F%90%E4%B8%AA%E6%96%87%E4%BB%B6%E5%A4%B9%E5%88%B0%E6%8C%87%E5%AE%9A%E5%88%86%E6%94%AF"><span class="nav-number">1.5.</span> <span class="nav-text">上传某个文件夹到指定分支</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%8E%A8%E9%80%81%E5%A4%B1%E8%B4%A5%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88"><span class="nav-number">1.6.</span> <span class="nav-text">推送失败解决方案</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%85%B6%E4%BB%96%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98"><span class="nav-number">1.7.</span> <span class="nav-text">其他相关问题</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#git-commit%E6%8A%A5%E9%94%99"><span class="nav-number">1.7.1.</span> <span class="nav-text">git commit报错</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#git-push-origin-master%E6%8A%A5%E9%94%99"><span class="nav-number">1.7.2.</span> <span class="nav-text">git push origin master报错</span></a></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

     

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Crf's Blog"
      src="/images/touxiang.gif">
  <p class="site-author-name" itemprop="name">Crf's Blog</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">11</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">20</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="mailto:3303538033@qq.com" title="E-Mail → mailto:3303538033@qq.com" rel="noopener" target="_self"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://blog.csdn.net/weixin_44209860/article/details/126509442?spm=1001.2014.3001.5502" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;weixin_44209860&#x2F;article&#x2F;details&#x2F;126509442?spm&#x3D;1001.2014.3001.5502" rel="noopener" target="_self"><i class="fa csdn fa-fw"></i>CSDN</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://gitee.com/Aoce888" title="GITEE → https:&#x2F;&#x2F;gitee.com&#x2F;Aoce888" rel="noopener" target="_self"><i class="fa gitee fa-fw"></i>GITEE</a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_self"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      相关链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://yp.rfcode.top/" title="https:&#x2F;&#x2F;yp.rfcode.top&#x2F;" rel="noopener" target="_self">第一份实习简历</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://playable.rfcode.top/" title="https:&#x2F;&#x2F;playable.rfcode.top&#x2F;" rel="noopener" target="_self">Playable</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://rfcode.top/duli/" title="https:&#x2F;&#x2F;rfcode.top&#x2F;duli&#x2F;" rel="noopener" target="_self">独立小游戏</a>
        </li>
    </ul>
  </div>

      </div>
    <div>

   <!--网易云音乐插件-->
    <div>
    <!-- require APlayer -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css">
    <script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
    <!-- require MetingJS-->
    <script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script> 
    <!--网易云playlist外链地址-->   
    <meting-js
        server="netease"
        type="playlist" 
        id="8425659719"
        mini="false"
        fixed="false"
        list-folded="true"
        autoplay="false"
        volume="0.4"
        theme="#FADFA3"
        order="list"
        loop="all"
        preload="auto"
        mutex="true">
    </meting-js></div>
    </div>
    
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_self">粤ICP备20000717号 </a>
      <img src="/images/beian.png" style="display: inline-block;">
  </div>

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Crf's Blog</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">9k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">33 分钟</span>
</div>

<div>
<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
    var now = new Date(); 
    function createtime() { 
        var grt= new Date("08/10/2020 00:00:00");//在此处修改你的建站时间
        now.setTime(now.getTime()+250); 
        days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days); 
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours); 
        if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum); 
        mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;} 
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum); 
        snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;} 
        document.getElementById("timeDate").innerHTML = "已运行 "+dnum+" 天 "; 
        document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒"; 
    } 
setInterval("createtime()",250);
</script>
</div>

        
<div class="busuanzi-count">
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>










      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>

  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '.languages',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.dataset.pjax !== undefined) {
      script.dataset.pjax = '';
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  




  
<script src="/js/local-search.js"></script>













    <div id="pjax">
  

  

    </div>
</body>
</html>
